<template>
  <div>
    <el-form :model="form" label-width="auto" inline>
      <el-form-item label="所属仓库:">
        <el-select v-model="form.region" placeholder="please select your zone">
          <el-option label="Zone one" value="shanghai" />
          <el-option label="Zone two" value="beijing" />
        </el-select>
      </el-form-item>
      <el-form-item label="所属公司:">
        <el-select v-model="form.region" placeholder="please select your zone">
          <el-option label="Zone one" value="shanghai" />
          <el-option label="Zone two" value="beijing" />
        </el-select>
      </el-form-item>
      <el-form-item label="货区:">
        <el-select v-model="form.region" placeholder="please select your zone">
          <el-option label="Zone one" value="shanghai" />
          <el-option label="Zone two" value="beijing" />
        </el-select>
      </el-form-item>
      <el-form-item label="上家运单号:">
        <el-input v-model="form.name" />
      </el-form-item>
      <el-form-item label="采购订单号：">
        <el-input v-model="form.name" />
      </el-form-item>
      <el-form-item label="上家订单状态：">
        <el-select v-model="form.region" placeholder="please select your zone">
          <el-option label="Zone one" value="shanghai" />
          <el-option label="Zone two" value="beijing" />
        </el-select>
      </el-form-item>
      <el-form-item label="处理结果：">
        <el-select v-model="form.region" placeholder="please select your zone">
          <el-option label="Zone one" value="shanghai" />
          <el-option label="Zone two" value="beijing" />
        </el-select>
      </el-form-item>
      <el-form-item label="退货出库类型:">
        <el-select v-model="form.region" placeholder="please select your zone">
          <el-option label="Zone one" value="shanghai" />
          <el-option label="Zone two" value="beijing" />
        </el-select>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" @click="onSubmit">搜索</el-button>
      </el-form-item>
    </el-form>
  </div>
  <div class="table">
    <el-table :data="tableData" style="width: 100%" border>
      <el-table-column label="Column 1">
        <template #default="scope">{{ scope.row.name }}</template>
      </el-table-column>
      <el-table-column label="所属仓库">
        <template #default="scope">{{ scope.row.name }}</template>
      </el-table-column>
      <el-table-column label="所属公司">
        <template #default="scope">{{ scope.row.name }}</template>
      </el-table-column>
      <el-table-column label="货区">
        <template #default="scope">{{ scope.row.name }}</template>
      </el-table-column>
      <el-table-column label="入库批次">
        <template #default="scope">{{ scope.row.name }}</template>
      </el-table-column>
      <el-table-column label="商品信息" width="180">
        <template #default="scope">{{ scope.row.name }}</template>
      </el-table-column>
      <el-table-column label="接收时间" width="180">
        <template #default="scope">{{ scope.row.name }}</template>
      </el-table-column>
      <el-table-column label="退货出库类型" width="180">
        <template #default="scope">{{ scope.row.name }}</template>
      </el-table-column>
      <el-table-column label="到库运单号" width="180">
        <template #default="scope">{{ scope.row.name }}</template>
      </el-table-column>
      <el-table-column label="出库运单号" width="180">
        <template #default="scope">{{ scope.row.name }}</template>
      </el-table-column>
      <el-table-column label="采购订单号">
        <template #default="scope">{{ scope.row.name }}</template>
      </el-table-column>
      <el-table-column label="采购账号">
        <template #default="scope">{{ scope.row.name }}</template>
      </el-table-column>
      <el-table-column label="退货数量">
        <template #default="scope">{{ scope.row.name }}</template>
      </el-table-column>
      <el-table-column label="申请退货时间">
        <template #default="scope">{{ scope.row.name }}</template>
      </el-table-column>
      <el-table-column label="上家状态">
        <template #default="scope">{{ scope.row.name }}</template>
      </el-table-column>
      <el-table-column label="上家状态变更时间">
        <template #default="scope">{{ scope.row.name }}</template>
      </el-table-column>
      <el-table-column label="处理结果" width="180">
        <template #default="scope">{{ scope.row.name }}</template>
      </el-table-column>
      <el-table-column label="操作" width="180">
        <template #default="scope">
          <el-button link type="primary" size="small" @click.prevent="lookDetails(scope.row)">
            销毁
          </el-button>
          <el-button link type="primary" size="small" @click.prevent="GeneratePurchaseOrder(scope.row)">
            退货完成
          </el-button>
        </template>
      </el-table-column>
    </el-table>
  </div>
  <div class="page">
    <el-pagination v-model:current-page="currentPage4" v-model:page-size="pageSize4" :page-sizes="[10, 50, 100]"
      layout="total, sizes, prev, pager, next, jumper" :total="total" @size-change="handleSizeChange"
      @current-change="handleCurrentChange" />
  </div>
</template>

<script setup>
import { ref } from 'vue'

// do not use same name with ref
const form = ref({
  pageSize: 10,
  pageNum: 1
})
const tableData = ref([])

const onSubmit = () => {
  console.log('submit!')
}
const getList = () => {
  // shopLIst(form.value).then(res => {
  //   const { data: { data } } = res
  //   total.value = data.total
  //   tableData.value = data.list
  // })
}
// 分页
const currentPage4 = ref(1)
const pageSize4 = ref(10)
const total = ref(0)
const handleSizeChange = (val) => {
  console.log(`${val} items per page`)
  form.value.pageSize = val
  getList()
}
const handleCurrentChange = (val) => {
  console.log(`current page: ${val}`)
  form.value.pageNum = val
  getList()
}
</script>

<style lang='less' scoped></style>
